package com.learn.xueer.ui.adapter

import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.learn.xueer.R
import com.learn.xueer.data.model.bean.BannerInfo
import com.learn.xueer.data.model.bean.Child
import com.learn.xueer.data.model.bean.SchoolResponse

class LetterAdapter(data: MutableList<SchoolResponse>,var call: (Child) -> Unit) :
    BaseQuickAdapter<SchoolResponse, BaseViewHolder>(R.layout.item_letter_layout, data) {
    override fun convert(holder: BaseViewHolder, item: SchoolResponse) {

        holder.setText(R.id.tvLetter, item.name)

        var letterItemAdapter = LetterItemAdapter(item.children ?: ArrayList())
        holder.getView<RecyclerView>(R.id.rvData).adapter = letterItemAdapter
        letterItemAdapter.setOnItemClickListener { baseQuickAdapter, view, i ->
            var get = letterItemAdapter.data.get(i)
            call(get)
        }
    }
}